<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="<%=request.getContextPath() %>/css/index3.css" rel="stylesheet">
</head>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

	function page(pn){
		$("#pn").val(pn);
		$("#fix").submit()
	}
	function del(id){
		$.post("del",{sid:id},function(json){
			if (confirm) {
				alert("确定要删除"+id+"吗")
				if (json) {
					alert("删除成功")
					location.reload();
					return
				} else{
					alert("删除失败")
					return
				}
			
			}
		},"json")
	}
	function add(){
		location.href="toadd";
	}
</script>
<body>
<center>
	<form action="list" method="post" id="fix">
		<input type="hidden" name="pn" id="pn">
		姓名<input type="text" name="name" value="${name }">
		费用<input type="text" name="startMoney" value="${startMoney }">
		~<input type="text" name="endMoney" value="${endMoney }">
		<input type="submit" value="查询">
	</form> 
	<table>
	<tr>
		<td colspan="100">
			<input type="button" value="添加" onclick="add()">
		</td>
	</tr>
		<tr>
			<td>编号</td>
			<td>地点</td>
			<td>具体地址</td>
			<td>出场费用</td>
			<td>效果图</td>
			<td>拍摄人</td>
			<td>操作</td>
		</tr>
		<c:forEach items="${info.list }" var="cust">
			<tr>
			<td>${cust.sid }</td>
			<td>${cust.sname }</td>
			<td>${cust.saddress }</td>
			<td>${cust.smoney }</td>
			<td>
				<c:if test="${cust.spic !=null ||cust.spic !='' }">
					<img width="100px" src="<%=request.getContextPath() %>/upload/${cust.spic}">
				</c:if>
			</td>
			<td>${cust.cnames }</td>
			<td>
			<input type="button" value="删除" onclick="del(${cust.sid })">
			</td>
		</tr>
		</c:forEach>
		<tr>
			<td colspan="100">
				当前页${info. pageNum }/${info.pageSize}   总条数${info.total }
				<input type="button" value="首页" onclick="page(1)">
				<input type="button" value="上一页" onclick="page(${info.prePage })">
				<input type="button" value="下一页" onclick="page(${info.nextPage })">
				<input type="button" value="尾页" onclick="page(${pages})">
			</td>
		</tr>
	</table>
</center>
</body>
</html>